<?php
defined("_VALID_ACCESS") || die('Direct access forbidden');
class Eyeworx_Inventory_FramesImportCommon extends ModuleCommon
{

    public function menu()
    {
        return array(
            _M('Eyeworx') => array(
                '__submenu__' => 1,
                _M('Imports') => array(
                    '__submenu__' => 1,
                    '__weight__' => 0,
                    _M('Frames') => array('__weight__' => 0),
                ),
            )
        );
    }

    public static function submit_frame($r, $mode)
    {
        if ($mode == 'added') {
            $total = DB::GetOne("select f_total_qty from eyeworx_frames_data_1 where id='".$r['frame']."'");
            $add_to_total = $r['quantity'];
            $new_total = intval($total) + intval($add_to_total);
            DB::Execute("update eyeworx_frames_data_1 set f_total_qty=%s where id=%s", array($new_total, $r['frame']));
        }
    }

}

?>